package com.company.pangu.aliyun.ocr.response;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * <p>银行卡识别响应</p >
 *
 * @author youyoukele
 * @version 1.0
 * @date 2023/4/6 下午5:56
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
public class RecognizeBankCardResponse implements Serializable {

    /**
     * algo_version : 7a6241b9ccce3746da42ff09ee692b27721728bb;7a6241b9ccce3746da42ff09ee692b27721728bb
     * data : {"bankName":"交通银行","cardNumber":"6222621370000783456","validToDate":"2024/12","cardType":"DC"}
     * ftype : 0
     * height : 2139
     * orgHeight : 2139
     * orgWidth : 3116
     * prism_keyValueInfo : [{"key":"bankName","keyProb":100,"value":"交通银行","valuePos":[{"x":374,"y":169},{"x":1344,"y":143},{"x":1350,"y":344},{"x":379,"y":370}],"valueProb":100},{"key":"cardNumber","keyProb":100,"value":"6222621370000783456","valuePos":[{"x":103,"y":1253},{"x":3011,"y":1137},{"x":3021,"y":1370},{"x":112,"y":1486}],"valueProb":100},{"key":"validToDate","keyProb":100,"value":"2024/12","valuePos":[{"x":1347,"y":1573},{"x":2074,"y":1554},{"x":2077,"y":1698},{"x":1351,"y":1718}],"valueProb":100},{"key":"cardType","keyProb":100,"value":"DC","valuePos":[{"x":437,"y":445},{"x":1316,"y":433},{"x":1318,"y":541},{"x":439,"y":553}],"valueProb":100}]
     * sliceRect : {"x0":0,"y0":8,"x1":3110,"y1":0,"x2":3116,"y2":2046,"x3":0,"y3":2139}
     * width : 3116
     */

    @JsonProperty("algo_version")
    private String algoVersion;
    @JsonProperty("data")
    private Data data;
    @JsonProperty("ftype")
    private int ftype;
    @JsonProperty("height")
    private int height;
    @JsonProperty("orgHeight")
    private int orgHeight;
    @JsonProperty("orgWidth")
    private int orgWidth;
    @JsonProperty("sliceRect")
    private SliceRect sliceRect;
    @JsonProperty("width")
    private int width;
    @JsonProperty("prism_keyValueInfo")
    private List<PrismKeyValueInfo> prismKeyValueInfo;


    @lombok.Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Data {
        /**
         * bankName : 交通银行
         * cardNumber : 6222621370000783456
         * validToDate : 2024/12
         * cardType : DC
         */

        @JsonProperty("bankName")
        private String bankName;
        @JsonProperty("cardNumber")
        private String cardNumber;
        @JsonProperty("validToDate")
        private String validToDate;
        @JsonProperty("cardType")
        private String cardType;

    }

    @lombok.Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class SliceRect {
        /**
         * x0 : 0
         * y0 : 8
         * x1 : 3110
         * y1 : 0
         * x2 : 3116
         * y2 : 2046
         * x3 : 0
         * y3 : 2139
         */

        @JsonProperty("x0")
        private int x0;
        @JsonProperty("y0")
        private int y0;
        @JsonProperty("x1")
        private int x1;
        @JsonProperty("y1")
        private int y1;
        @JsonProperty("x2")
        private int x2;
        @JsonProperty("y2")
        private int y2;
        @JsonProperty("x3")
        private int x3;
        @JsonProperty("y3")
        private int y3;

    }

    @lombok.Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class PrismKeyValueInfo {
        /**
         * key : bankName
         * keyProb : 100
         * value : 交通银行
         * valuePos : [{"x":374,"y":169},{"x":1344,"y":143},{"x":1350,"y":344},{"x":379,"y":370}]
         * valueProb : 100
         */

        @JsonProperty("key")
        private String key;
        @JsonProperty("keyProb")
        private int keyProb;
        @JsonProperty("value")
        private String value;
        @JsonProperty("valueProb")
        private int valueProb;
        @JsonProperty("valuePos")
        private List<ValuePos> valuePos;

        @lombok.Data
        @JsonIgnoreProperties(ignoreUnknown = true)
        public static class ValuePos {
            /**
             * x : 374
             * y : 169
             */

            @JsonProperty("x")
            private int x;
            @JsonProperty("y")
            private int y;

        }
    }
}
